import 'package:flutter/material.dart';
import 'package:ost_flutter_module/common/adapt.dart';
import 'package:ost_flutter_module/common/color.dart';
import 'package:ost_flutter_module/common/styles.dart';
import 'package:ost_flutter_module/common/utils.dart';
import 'package:ost_flutter_module/widget/custom_widget/custome_divider.dart';
import 'package:ost_flutter_module/widget/custom_widget/custome_list_tile.dart';
import 'package:ost_flutter_module/widget/custom_widget/custome_size_icon_button.dart';
import 'package:ost_flutter_module/widget/custom_widget/custome_textfiled.dart';
import 'package:ost_flutter_module/widget/custom_widget/text_button.dart';

class StorePayAmountWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        SizedBox(height: Adapt.px(20)),
        Text('￥120000可用'),
        Container(
          height: Adapt.px(44),
          margin: EdgeInsets.only(
            top: Adapt.px(20),
            left: Adapt.px(50),
            right: Adapt.px(50),
            bottom: Adapt.px(70),
          ),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(Adapt.px(22)),
            border: Border.all(color: color999999),
          ),
          child: GListTile(
            padding: EdgeInsets.only(left: Adapt.px(15)),
            leading:
                Container(child: Text('￥', style: TextStyles.detailTitleStyle)),
            trailing: GTextField(
                hintText: '请输入支付金额', keyboardType: TextInputType.number),
            enableWidget: GTextButton(
              radius: 22,
              title: '全部',
              normalForgroundColor: color2A51A1,
              onPressed: () {},
            ),
            onTap: null,
          ),
        ),
      ],
    );
  }
}

class StorePayModeWidget extends StatelessWidget {
  static const pays = ['支付宝', '微信支付'];
  static const payicons = ['icon_pay_al', 'icon_pay_wc'];

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        SizedBox(height: Adapt.px(20)),
        Text('￥2400', style: TextStyles.payAmountTitleStyle),
        SizedBox(height: Adapt.px(10)),
        RichText(
            text: TextSpan(
          text: '请在',
          style: TextStyles.titleStyle,
          children: [
            TextSpan(
              text: '14分23秒',
              style: TextStyles.payDownTimeTitleStyle,
            ),
            TextSpan(
              text: ' 内完成支付 ',
              style: TextStyles.titleStyle,
            ),
          ],
        )),
        SizedBox(height: Adapt.px(44)),
        Padding(
          padding: EdgeInsets.symmetric(horizontal: Adapt.px(30)),
          child: Column(
            children: [
              GDivider(),
              ListView.builder(
                shrinkWrap: true,
                physics: NeverScrollableScrollPhysics(),
                itemCount: pays.length,
                itemBuilder: (_, index) {
                  return Column(
                    children: [
                      GListTile(
                        padding: EdgeInsets.zero,
                        leading: Utils.svgAssets(payicons[index]),
                        text: pays[index],
                        enableWidget: GIconButton(
                          svg: Utils.svgAssets('icon_pay_unselected'),
                          color: color2A51A1,
                          size: Adapt.px(22),
                        ),
                        enable: true,
                        onTap: (value) {},
                      ),
                      GDivider(),
                    ],
                  );
                },
              ),
              Center(
                child: Container(
                  width: Adapt.px(180),
                  height: Adapt.px(36),
                  child: GTextButton(
                    title: '确认支付',
                    normalForgroundColor: color42270C,
                    normalBackgroundColor: colorFACD33,
                    radius: 18,
                    onPressed: () {
                      // onPressed();
                    },
                  ),
                ),
              ),
              SizedBox(height: Adapt.px(30)),
            ],
          ),
        ),
      ],
    );
  }
}
